package network;

import java.io.IOException;
import java.util.HashMap;
import java.util.Map;

public class TcpDictServer extends TcpEchoServer{

    private Map<String,String> dict = new HashMap<>();
    public TcpDictServer(int port) throws IOException {
        super(port);
        dict.put("书","book");
        dict.put("狗","dog");
        dict.put("猫","cat");
        dict.put("勺","wlx");
    }
    @Override
    public String process(String request) {
        return dict.getOrDefault(request,"没有这个单词");
    }

    public static void main(String[] args) throws IOException {
        TcpEchoServer tcpDictServer = new TcpDictServer(9090);
        tcpDictServer.start();
    }
}
